Skip to content

feat(time): support IANA time zones. close #14453 - #21739

Open
konzen wants to merge 2 commits into
apache:masterfrom
konzen:fix-14453
Open

feat(time): support IANA time zones. close #14453#21739
konzen wants to merge 2 commits into
apache:masterfrom
konzen:fix-14453

Conversation

@konzen

@konzen konzen commented Aug 17, 2026

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Adds global and per-time-axis IANA time-zone support for ticks, labels, tooltips, and time utilities while preserving useUTC compatibility.

Fixed issues

Details

Before: What was the problem?

Time axes could only use UTC or the browser/operating-system time zone. Charts could not select an IANA time zone or use different time zones for different axes.

After: How does it behave after the fixing?

Charts can define a global timeZone, overridden by timeZone on individual time axes. Time-axis ticks, labels, and tooltip values use the effective axis time zone.

The legacy useUTC option remains supported, and timeZone takes precedence when both are specified. Input parsing behavior is unchanged.

The implementation uses native Intl.DateTimeFormat, without external dependencies or a bundled time-zone database.

dst-gap dst-overlap tooltip-xy-timezones

Document Info

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes.

Related test cases or examples to use the new APIs

  • test/ut/spec/scale/time.test.ts
  • test/ut/spec/util/time.test.ts
  • test/ut/spec/util/format.test.ts
  • test/ut/spec/component/tooltip/timeZone.test.ts

Validation:

  • npm test
  • npm run checktype
  • npm run lint
  • npm run test:dts:fast

Merging options

  • Please squash the commits into a single one when merging.

Other information

This PR builds on the work started in #21475, continuing it with a native Intl.DateTimeFormat implementation and completing global and per-axis time-zone support, backward compatibility, DST handling, tooltips, tests, and documentation.

@echarts-bot

echarts-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

@plainheart plainheart added this to the TBD milestone Aug 18, 2026
@plainheart
plainheart requested review from 100pah and a lite review from Copilot and removed request for Copilot August 18, 2026 12:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds IANA time-zone support across time formatting utilities, time scales, and tooltips while preserving legacy useUTC behavior (deprecated) and keeping parsing semantics unchanged.

Changes:

  • Introduces global timeZone option and per-time-axis timeZone override, with precedence over useUTC.
  • Updates time utilities (format, roundTime, tick/unit helpers) to operate in an IANA time zone and adds offset tokens ({Z}, {ZZ}).
  • Threads axis/series time-zone context into tooltip markup generation and adds extensive unit tests for DST gaps/folds and performance.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/ut/spec/util/time.test.ts Adds unit tests for time-zone-aware formatting, rounding, DST behavior, caching, and deprecated boolean overload warnings.
test/ut/spec/util/format.test.ts Adds tests for makeValueReadable with time zones and legacy boolean behavior.
test/ut/spec/scale/time.test.ts Adds integration tests for time-axis timeZone resolution, tick generation across DST, label formatting, and performance checks.
test/ut/spec/component/tooltip/timeZone.test.ts Adds tooltip integration tests ensuring per-axis time zones are respected in markup and rendered tooltips.
src/util/types.ts Adds global timeZone option and deprecates useUTC in option typing.
src/util/time.ts Implements time-zone-aware formatting/rounding/unit detection and IANA offset calculations/caching via Intl.DateTimeFormat.
src/util/format.ts Updates makeValueReadable to accept time-zone strings (and deprecates boolean).
src/scale/Time.ts Moves tick generation and label formatting from useUTC to time-zone-aware logic.
src/model/Global.ts Adds global time-zone resolution/storage (getTimeZone) with validation and precedence rules.
src/coord/axisHelper.ts Resolves per-axis time zones (validated) when creating TimeScale.
src/coord/axisCommonTypes.ts Adds timeZone?: string to time-axis options.
src/component/tooltip/tooltipMarkup.ts Allows passing time-zone per value block and uses time-zone-aware readable formatting.
src/component/tooltip/seriesFormatTooltip.ts Assigns an appropriate time zone per tooltip value based on the value’s axis scale.
src/component/tooltip/TooltipView.ts Uses effective time zone when building tooltip markup and when formatting axis tooltips with string templates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/component/tooltip/seriesFormatTooltip.ts
Comment thread src/util/time.ts
Comment thread src/model/Global.ts
Comment thread src/util/time.ts
Comment thread src/util/time.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants